<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Rain Man</title>
<style type="text/css">
#target{ position:relative; }
</style>
<script type="text/javascript">
window.onload = function(){
    var target = document.getElementById('target');
    alert(target.offsetParent == document.documentElement) //IE8以下中指向<html>元素
    alert(target.offsetParent == document.body);    //FF、Safari等指向<body>元素
};
</script>
</head>

<body>
<div id="outer" class="test">
    <div id="inner">
        <div id="target" class="test">Target<br />rainman</div>
    </div>
</div>
</body>
</html>